<template>
  <div class="pages_content table">
    <el-container>
      <el-header>
        <breaDcrumb />
      </el-header>
      <el-main>
        <div class="header_right" @click="showCardNav = !showCardNav">
          <div class="title">搜索</div>
          <div>
            <div :class="{ 'arrowTransform': !showCardNav, 'arrowTransformReturn': showCardNav}">
              <i style="margin-right: 5px" class="el-icon-arrow-down"></i>
            </div>
          </div>
        </div>
        <div v-show="showCardNav" class="hr"></div>
        <el-collapse-transition>
          <div v-show="showCardNav">
            <div class="search">
              <span style="display: inline-block;margin-bottom: 10px;">
                <span style="margin-right: 12px;">客户名称</span>
                <el-input v-model="tableParam.name" style="width: 150px;" clearable placeholder="请输入" @keyup.enter.native="gettableData()" />
              </span>
              <span style="margin-left: 24px;">
                <span style="margin-right: 12px;">联系人</span>
                <el-input v-model="tableParam.linkman" style="width: 20%;max-width: 150px;" clearable placeholder="请输入" @keyup.enter.native="gettableData()" />
              </span>
              <el-button icon="el-icon-search" size="medium" class="bottom_all but1" @click="(tableParam.page = 1), gettableData()">查 询</el-button>
              <el-button size="medium" class="bottom_all_two" style="margin-left:12px;" @click="init()">重 置</el-button>
              <el-button size="medium" class="bottom_all_two" style="margin-left: 12px" @click="tableParamType = true">高级搜索</el-button>
            </div>
          </div>
        </el-collapse-transition>
        <div class="hr"></div>
        <div class="card">
          <div class="card_nav">
            <div>
              <el-button v-if="ButtonList.findIndex(res=>(res.buttonValue=='TIANJIA'))!==-1" size="small" class="bottom_all" style="margin-left: 0;" @click="addFromDate('添加客户'),disabledType=false">
                <i class="icon iconfont iconicon_button_add" style="font-size: 12px;"></i>
                添加客户
              </el-button>
              <el-button v-if="ButtonList.findIndex(res=>(res.buttonValue=='DAORU'))!==-1" size="small" class="bottom_three" @click="exportDialog = true">导入客户</el-button>
              <el-button v-if="ButtonList.findIndex(res=>(res.buttonValue=='SHANCHU'))!==-1" size="small" class="bottom_two" @click="Delete('update_status', 0)">
                <i class="icon iconfont iconicon_button_delete" style="font-size: 12px;"></i>
                删除
              </el-button>
            </div>
            <div>
              <el-dropdown :hide-on-click="false" trigger="click" style="margin: 0 20px;">
                <el-link :underline="false">
                  <span class="el-icon--left">
                    <i class="iconfont iconicon_button_filtrate"></i>
                  </span>
                  筛选
                </el-link>
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item v-for="(item, index) in table" :key="index">
                    <el-checkbox v-model="item.status">{{ item.label }}</el-checkbox>
                  </el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>
              <el-link v-if="ButtonList.findIndex(res=>(res.buttonValue=='DAOCHU'))!==-1" :underline="false" @click="load()">
                <span class="el-icon--left">
                  <i class="iconfont iconicon_button_export1"></i>
                </span>
                导出
              </el-link>
            </div>
          </div>
          <div v-loading="tableLoading" class="card_info" :style="style">
            <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width:100%" :data="tableData" tooltip-effect="dark" @selection-change="handleSelectionChange">
              <el-table-column align="center" type="selection"></el-table-column>
              <template v-for="(item, index2) in table">
                <el-table-column v-if="item.status" :key="index2" :label="item.label" align="center" :width="item.width">
                  <template slot-scope="scope">
                    <el-link v-if="item.label == '客户名称'" class="table_link" :underline="false" @click="updateFromDate(scope.row, '查看'),principalName = scope.row.createUserName,disabledType=true">{{scope.row.name}}
                    </el-link>
                    <div v-else-if="item.label == '初始信用等级'">
                      <span v-if="scope.row.initialCreditGrade==1">1星</span>
                      <span v-if="scope.row.initialCreditGrade==2">2星</span>
                      <span v-if="scope.row.initialCreditGrade==3">3星</span>
                      <span v-if="scope.row.initialCreditGrade==4">4星</span>
                      <span v-if="scope.row.initialCreditGrade==5">5星</span>
                    </div>
                    <div v-else-if="item.label == '最新信用等级'">
                      <span v-if="scope.row.newestCreditGrade==1">1星</span>
                      <span v-if="scope.row.newestCreditGrade==2">2星</span>
                      <span v-if="scope.row.newestCreditGrade==3">3星</span>
                      <span v-if="scope.row.newestCreditGrade==4">4星</span>
                      <span v-if="scope.row.newestCreditGrade==5">5星</span>
                    </div>
                    <div v-else-if="item.label == '历史履约记录'">
                      <el-button v-if="ButtonList.findIndex(res=>(res.buttonValue=='HEZUOGONGC'))!==-1" size="mini" class="bottom_one" @click="changeEngineerings(scope.row)">查看</el-button>
                    </div>
                    <div v-else-if="item.label == '操作'">
                      <el-button v-if="ButtonList.findIndex(res=>(res.buttonValue=='XIUGAIGC'))!==-1" size="mini" class="bottom_one" @click="updateFromDate(scope.row, '修改'),principalName = scope.row.createUserName,disabledType=false">修改</el-button>
                      <!-- <el-button v-if="ButtonList.findIndex(res=>(res.buttonValue=='HEZUOGONGC'))!==-1" size="mini" class="bottom_one" @click="changeEngineerings(scope.row)">合作工程</el-button> -->
                    </div>
                    <span v-else>{{ scope.row[item.prop] }}</span>
                  </template>
                </el-table-column>
              </template>
            </el-table>
          </div>
          <div class="card_bottom">
            <div class="card_bottom_left">
              <div class="top_page_totle">总共{{ total }}条</div>
              <el-pagination :current-page.sync="tableParam.page" :page-size="tableParam.pageSize" layout="prev, pager, next, jumper" :total="total" @current-change="gettableData()"></el-pagination>
            </div>
            <div>
              <el-button size="mini" icon="el-icon-refresh-right" class="bottom_all_two" @click="gettableData">刷新</el-button>
            </div>
          </div>
        </div>
      </el-main>
    </el-container>
    <el-dialog v-dialogDrag :visible.sync="addDialog" width="1000px" :close-on-click-modal="false" :before-close="resetFromDate">
      <span slot="title" class="dialog-title">{{ addDialogTitle }}</span>
      <div class="dialoginfo">
        <el-form ref="reffromDate" :rules="rules" :inline="true" :model="fromDate" label-width="110px" :disabled="disabledType">
          <el-form-item prop="name">
            <span slot="label" style="color:  #FF0000 ;">客户名称</span>
            <el-input v-model="fromDate.name" placeholder="请输入" clearable></el-input>
          </el-form-item>
          <el-form-item prop="companyNatureId">
            <span slot="label" style="color:  #FF0000 ;">企业性质</span>
            <el-select v-model="fromDate.companyNatureId" placeholder="请选择">
              <el-option v-for="item in companyNatureIdlist" :key="item.id" :label="item.itemName" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="establishedTime">
            <span slot="label" style="color:  #FF0000 ;">成立日期</span>
            <el-date-picker v-model="fromDate.establishedTime" type="date" placeholder="选择日期时间"></el-date-picker>
          </el-form-item>
          <el-form-item prop="capitalKey">
            <span slot="label" style="color:  #FF0000 ;">出资结构</span>
            <el-input v-model="fromDate.capitalKey" placeholder="请输入" clearable></el-input>
          </el-form-item>
          <el-form-item prop="registeredCapital">
            <span slot="label" style="color:  #FF0000 ;">注册资本</span>
            <el-input v-model="fromDate.registeredCapital" placeholder="请输入" onkeypress='return( /\d|\./.test(String.fromCharCode(event.keyCode)))' @input="fromDate.registeredCapital=$regExp.checkNum(fromDate.registeredCapital)" @blur="fromDate.registeredCapital=$regExp.blurCheckNum(fromDate.registeredCapital)">
              <template slot="append">万元</template>
            </el-input>
          </el-form-item>
          <el-form-item prop="registeredAddress">
            <span slot="label" style="color:  #FF0000 ;">注册地址</span>
            <el-input v-model="fromDate.registeredAddress" placeholder="请输入" clearable></el-input>
          </el-form-item>
          <el-form-item prop="businessAddress">
            <span slot="label" style="color:  #FF0000 ;">经营地址</span>
            <el-input v-model="fromDate.businessAddress" placeholder="请输入" clearable></el-input>
          </el-form-item>
          <el-form-item>
            <span slot="label">合作等级</span>
            <el-select ref="cooperationClass" v-model="fromDate.cooperationClassId" placeholder="请选择" @change="$nextTick(()=>{fromDate.cooperationClass = $refs.cooperationClass.selectedLabel})">
              <el-option v-for="item in cooperationClassIdlist" :key="item.id" :label="item.itemName" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="" label-width="120px">
            <span slot="label">控股/控制权股东</span>
            <el-input v-model="fromDate.stockholder" style="width:310px;" placeholder="请输入" clearable></el-input>
          </el-form-item>
          <el-form-item prop="linkman">
            <span slot="label">联系人</span>
            <el-input v-model="fromDate.linkman" placeholder="请输入" clearable></el-input>
          </el-form-item>
          <el-form-item prop="phone">
            <span slot="label">联系电话</span>
            <el-input v-model="fromDate.phone" type="Number" placeholder="请输入" clearable></el-input>
          </el-form-item>
          <el-form-item prop="roadworkGradeId" label-width="140px">
            <span slot="label" style="color:  #FF0000 ;">施工总承办资质等级</span>
            <el-select ref="roadworkGrade" v-model="fromDate.roadworkGradeId" placeholder="请选择" style="width:290px;" @change="$nextTick(()=>{fromDate.roadworkGrade = $refs.roadworkGrade.selectedLabel}), fromDate.initialCreditGrade=fromDate.roadworkGradeId">
              <el-option label="特级" :value="1"></el-option>
              <el-option label="一级" :value="2"></el-option>
              <el-option label="二级" :value="3"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <span slot="label">初始信用等级</span>
            <el-select v-model="fromDate.initialCreditGrade" disabled>
              <el-option label="3星" :value="1"></el-option>
              <el-option label="2星" :value="2"></el-option>
              <el-option label="1星" :value="3"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="remark">
            <span slot="label">备注信息</span>
            <el-input v-model="fromDate.remark" :rows="5" resize="none" style="width: 760px;" type="textarea" placeholder="请输入" clearable></el-input>
          </el-form-item>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button v-show="disabledType" class="bottom_all_two" @click="resetFromDate">关 闭</el-button>
        <el-button v-show="!disabledType" class="bottom_all_two" @click="resetFromDate">取 消</el-button>
        <el-button v-show="!disabledType" class="bottom_all" style="margin-left: 24px;" @click="submit()">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 导入 -->
    <el-dialog v-dialogDrag :visible.sync="exportDialog" width="680px" :close-on-click-modal="false">
      <span slot="title" class="dialog-title">导入客户数据</span>
      <div v-loading="loading" element-loading-text="数据解析中..." element-loading-background="rgba(0, 0, 0, 0.8)" class="dialoginfo" style="text-align: center;">
        <el-upload class="upload-demo" :on-success="fileSuccess" :before-upload="filebefore" :show-file-list="false" drag action="/icps/system/sign/cloudsell/custommanage/importList" name="file" :headers="upheader">
          <i slot="trigger" class="el-icon-upload"></i>
          <div slot="trigger" class="el-upload__text">
            将文件拖到此处，或
            <em>点击选取文件</em>
          </div>
        </el-upload>
        <div style="padding-top: 10px;">
          <el-button class="bottom_all" style="margin-left: 0;" @click="importSubmit()">下载模板</el-button>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="exportDialog = false">关 闭</el-button>
      </span>
    </el-dialog>
    <!-- 合作工程 -->
    <el-dialog v-dialogDrag :visible.sync="cooperationDialog" width="980px" :close-on-click-modal="false">
      <span slot="title" class="dialog-title">合作项目</span>
      <div>
        <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width:100%" :data="cooperationlist" tooltip-effect="dark">
          <el-table-column label="工程编号" align="center" prop="code"></el-table-column>
          <el-table-column label="工程名称" align="center" prop="name"></el-table-column>
          <el-table-column label="工程地址" align="center" prop="place"></el-table-column>
          <el-table-column label="行政区" align="center" prop='administrativeDistricts' width="170"></el-table-column>
          <el-table-column label="初始供应时间" align="center" prop="beginTime"></el-table-column>
          <el-table-column label="累计销量" align="center" prop="salesVolume"></el-table-column>
          <el-table-column label="累计产值" align="center" prop="unitPrice"></el-table-column>
          <el-table-column label="累计回款" align="center" prop="returnedMoney"></el-table-column>
          <el-table-column label="逾期付款次数" align="center" prop="numberOfPayment"></el-table-column>
          <el-table-column label="逾期结算次数" align="center" prop="numberOfsettlement"></el-table-column>
          <el-table-column label="供应索赔记录" align="center" prop="">
            <template slot-scope="scope">
              <el-link class="table_link" :underline="false" @click="getByTypeData(scope.row,1,'供应索赔记录')">查看
              </el-link>
            </template>
          </el-table-column>
          <el-table-column label="质量索赔记录" align="center" prop="">
            <template slot-scope="scope">
              <el-link class="table_link" :underline="false" @click="getByTypeData(scope.row,2,'质量索赔记录')">查看
              </el-link>
            </template>
          </el-table-column>
          <el-table-column label="公信平台预警信息" align="center" prop="">
            <template slot-scope="scope">
              <el-link class="table_link" :underline="false" @click="getByTypeData(scope.row,5,'公信平台预警信息')">查看
              </el-link>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="cooperationDialog = false">关 闭</el-button>
      </span>
    </el-dialog>
    <!-- 高级搜索 -->
    <el-dialog v-dialogDrag :visible.sync="tableParamType" width="650px" :close-on-click-modal="false">
      <span slot="title" class="dialog-title">高级搜索</span>
      <div class="dialoginfo">
        <el-form ref="reftableParam" :inline="true" :model="tableParam" label-width="110px">
          <el-form-item>
            <span slot="label">企业性质</span>
            <el-select v-model="tableParam.companyNatureId" placeholder="请选择" style="width:400px;">
              <el-option v-for="item in companyNatureIdlist" :key="item.id" :label="item.itemName" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="cooperationClassId">
            <span slot="label">合作等级</span>
            <el-select v-model="tableParam.cooperationClassId" style="width: 400px;" placeholder="请选择">
              <el-option v-for="item in cooperationClassIdlist" :key="item.id" :label="item.itemName" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item prop="clientTypeId">
            <span slot="label">客户类型</span>
            <el-select v-model="tableParam.clientTypeId" style="width: 400px;" placeholder="请选择">
              <el-option v-for="item in clientTypeIdlist" :key="item.id" :label="item.itemName" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <span slot="label">成立时间</span>
            <el-date-picker v-model="startTimDateEndTimDate" type="daterange" value-format="yyyy-MM-dd" start-placeholder="开始时间" end-placeholder="结束时间" @change="tableParam.startTimDate=startTimDateEndTimDate[0]||'',tableParam.endTimDate=startTimDateEndTimDate[1]||''"></el-date-picker>
          </el-form-item>
          <el-form-item>
            <span slot="label">注册资本</span>
            <el-input v-model="tableParam.minValue" tplaceholder="请输入" clearable style="width:150px;"></el-input>
            -
            <el-input v-model="tableParam.maxValue" tplaceholder="请输入" clearable style="width:150px;"></el-input>
          </el-form-item>
          <el-form-item>
            <span slot="label">出资结构</span>
            <el-input v-model="tableParam.capitalKey" tplaceholder="请输入" clearable style="width:400px;"></el-input>
          </el-form-item>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="tableParamType=false,tableParam.companyNatureId='',startTimDateEndTimDate=[],tableParam.startTimDate='',tableParam.endTimDate='',tableParam.minValue='',tableParam.maxValue='',tableParam.capitalKey=''">取 消</el-button>
        <el-button class="bottom_all" style="margin-left: 24px" @click="gettableData(),tableParamType=false">搜 索</el-button>
      </span>
    </el-dialog>
    <!-- 资信记录 -->
    <el-dialog v-dialogDrag :visible.sync="look5Type" width="780px" :close-on-click-modal="false">
      <span slot="title" class="dialog-title">{{look5TypeName}}</span>
      <div class="dialoginfo" style="padding: 0">
        <!-- <div class="dialoginfo-title">
          <div :class="type == 1 ? 'active' : 'none'">
            <div>供应索赔记录</div>
          </div>
          <div :class="type == 2 ? 'active' : 'none'">
            <div>质量索赔记录</div>
          </div>
          <div :class="type == 5 ? 'active' : 'none'">
            <div>公信平台预警信息</div>
          </div>
        </div> -->
        <div class="dialoginfo-info">
          <el-timeline v-if="ByTypeData.length">
            <template v-for="(item, index) in ByTypeData">
              <el-timeline-item :key="index" :timestamp="item.createTime" placement="top">
                <el-card>
                  <p>{{ item.content }}</p>
                  <div style="text-align: right; color: #808080">
                    更新人：{{ item.createUserName }}
                  </div>
                </el-card>
              </el-timeline-item>
            </template>
          </el-timeline>
          <div v-else class="no-data">暂无数据</div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="look5Type=false">关 闭</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import mixin from "@/mixins/ICPSmixin.js";
import { getDicType, permissionsCompanyList } from "@/api/common.js";
import {
  queryPage,
  batchUpdateOrDelete,
  updateSortNum,
  saveOrUpdate,
  Download,
  OtherDownload,
  getEngineeringsByid,
} from "@/api/internetSales/customer.js";
import { orgUserTree } from "@/api/common.js";
import { getToken, getUserId } from '@/utils/auth';
import { getListByType } from "@/api/internetSales/performanceRecord.js";
export default {
  mixins: [mixin],
  data() {
    var landlinePhone = (rule, value, callback) => {
      if (value && !this.$regExp.landlinePhoneReg(value)) {
        return callback(new Error('电话格式错误！'));
      } else {
        callback();
      }
    };
    return {
      look5TypeName: '',
      ByTypeData: [],
      type: '',
      look5Type: false,
      startTimDateEndTimDate: [],
      tableParamType: false,
      disabledType: false,
      companylist: [],
      principalarr: [],
      principalName: "",
      /*表格增删改查及下载接口*/
      queryPage: queryPage,
      batchUpdateOrDelete: batchUpdateOrDelete,
      updateSortNum: updateSortNum,
      saveOrUpdate: saveOrUpdate,
      DownloadURL: Download,
      upheader: {
        "access-token": getToken(),
        "user-id": getUserId(),
      },
      loading: false,
      /*表格数据*/
      table: [
        {
          label: "客户名称",
          width: "",
          prop: "name",
          status: true,
        },
        {
          label: "企业性质",
          width: "",
          prop: "companyNature",
          status: true,
        },
        {
          label: "成立时间",
          width: "",
          prop: "establishedTime",
          status: true,
        },
        {
          label: "注册资本",
          width: "",
          prop: "registeredCapital",
          status: true,
        },
        {
          label: "出资结构",
          width: "",
          prop: "capitalKey",
          status: true,
        },
        {
          label: "合作等级",
          width: "",
          prop: "cooperationClass",
          status: true,
        },
        {
          label: "联系人",
          width: "",
          prop: "linkman",
          status: true,
        },
        {
          label: "联系电话",
          width: "",
          prop: "phone",
          status: true,
        },
        {
          label: "控制权股东",
          width: "",
          prop: "stockholder",
          status: true,
        },
        {
          label: "初始信用等级",
          width: "",
          prop: "initialCreditGrade",
          status: true,
        },
        {
          label: "最新信用等级",
          width: "",
          prop: "newestCreditGrade",
          status: true,
        },
        {
          label: "历史履约记录",
          width: "",
          prop: "",
          status: true,
        },
        {
          label: "操作",
          width: "180",
          prop: "",
          status: true,
        },
      ],
      /*表单页类型，0为无树状，1为有树状，有树状在el-main加上display:flex*/
      pagesType: 0,
      /*添加表单数据*/
      rules: {
        name: [{ required: true, message: "请输入客户名称", trigger: "blur" }],
        companyNatureId: [
          { required: true, message: "请选择企业性质", trigger: "change" },
        ],
        establishedTime: [
          { required: true, message: "请选择成立时间", trigger: "blur" },
        ],
        capitalKey: [
          { required: true, message: "请输入出资结构", trigger: "blur" },
        ],
        registeredCapital: [
          { required: true, message: "请输入注册资本", trigger: "blur" },
        ],
        registeredAddress: [
          { required: true, message: "请输入注册地址", trigger: "blur" },
        ],
        businessAddress: [
          { required: true, message: "请输入经营地址", trigger: "blur" },
        ],
        clientTypeId: [
          { required: true, message: "请选择客户类型", trigger: "blur" },
        ],
        cooperationClassId: [
          { required: true, message: "请选择合作等级", trigger: "blur" },
        ],
        roadworkGradeId: [
          { required: true, message: "请选择施工总承办资质等级", trigger: "change" },
        ],
        phone: [{ validator: landlinePhone, trigger: 'change' }]
      },
      fromDate: {
        name: "",
        companyNature: "",
        companyNatureId: "",
        establishedTime: "",
        capitalKey: "",
        registeredCapital: "",
        registeredAddress: "",
        businessAddress: "",
        cooperationClass: "",
        cooperationClassId: "",
        clientType: "",
        clientTypeId: "",
        linkman: "",
        phone: "",
        remark: "",
      },
      companyNatureIdlist: [],
      cooperationClassIdlist: [],
      clientTypeIdlist: [],
      exportDialog: false,
      cooperationDialog: false,
      cooperationlist: [],
    };
  },
  async created() {
    this.companylist = await permissionsCompanyList()
    this.principalarr = await orgUserTree();
    /*存储拷贝的原初始化fromDate数据*/
    this.tableParam = { ...this.tableParam, name: "", linkman: "", companyNatureId: '', startTimDate: '', endTimDate: '', minValue: '', maxValue: '', capitalKey: '' };
    this.gettableData();
    getDicType({ code: "enterType" }).then((res) => {
      this.companyNatureIdlist = res.data.items;
    });
    getDicType({ code: "coopLevel" }).then((res) => {
      this.cooperationClassIdlist = res.data.items;
    });
    getDicType({ code: "customerType" }).then((res) => {
      this.clientTypeIdlist = res.data.items;
    });
  },
  /*
   *copy(data)深拷贝数据,返回拷贝完的数据
   *gettableData获取列表数据
   *load下载
   *SortNum保持序列号
   * UpdateOrDelete禁用，启用，删除
   * submitFromDate保存更新数据
   */
  methods: {
    getByTypeData(row, type, name) {
      this.look5TypeName = name
      this.look5Type = true
      this.type = type
      getListByType({ engineeringManagementId: row.id, type: type }).then(
        (res) => {
          this.ByTypeData = res.data;
        }
      );
    },
    /*合作工程*/
    changeEngineerings(low) {
      getEngineeringsByid({ id: low.id }).then((res) => {
        this.cooperationlist = res.data;
        console.log(res.data);
        this.cooperationDialog = true;
      });
    },
    init() {
      /*重置数据*/
      this.tableParam.name = "";
      this.tableParam.linkman = "";
      this.gettableData();
    },
    submit() {
      let _this = this;
      _this.$refs.reffromDate.validate((valid) => {
        if (valid) {
          _this.fromDate.establishedTime = new Date(
            _this.fromDate.establishedTime
          ).Format("yyyy-MM-dd");
          _this.fromDate.companyNature = _this.companyNatureIdlist.find(
            function (obj) {
              return obj.id == _this.fromDate.companyNatureId;
            }
          ).itemName;
          _this.submitFromDate();
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    fileSuccess(res) {
      this.loading = false
      if (res.code == 1001) {
        if (res.data.importStatus == 0) {
          this.$message.error(res.data.importResut);
          return
        }
        this.$message({
          dangerouslyUseHTMLString: true,
          message: `本次导入数据成功${res.data.successNum}条，失败<span style="color:red">${res.data.failureNum}</span>条！！！`,
          type: 'success'
        });
        if (res.data.failureNum !== 0) {
          let text = res.data.errResult.map(res => (res.name + '-' + res.reason)).join('</br>')
          this.$notify.error({
            title: '导入失败信息',
            dangerouslyUseHTMLString: true,
            message: text,
            duration: 0
          });
        }
        if (res.data.successNum !== 0) {
          this.gettableData()
        }
      } else {
        this.$message.error(res.codeMsg);
      }
    },
    filebefore(file) {
      this.loading = true
      const isJPG = file.type === 'application/vnd.ms-excel';
      if (!isJPG) {
        this.$message.error('数据上传必须是 xls 格式!');
        this.loading = false
      }
      return isJPG;
    },
    importSubmit() {
      this.$Download(OtherDownload);
    },
  },
};
</script>

<style lang="scss" scoped>
.table_top {
  color: #008000;
}
.table_top:hover {
  color: #008000 !important;
  opacity: 0.8;
}
.el-input,
.el-select {
  width: 320px;
}
.table_link {
  margin-left: 10px;
  color: $bg_color;
}
.table_link:hover {
  opacity: 0.8;
}
.dialoginfo-title {
  > div {
    cursor: pointer;
  }
  height: 48px;
  display: flex;
  background: linear-gradient(
    180deg,
    rgba(250, 252, 255, 1) 0%,
    rgba(245, 247, 250, 1) 100%
  );
  .none {
    font-weight: bold;
    height: 48px;
    @include discen;
    width: calc(100% / 2);
    border-bottom: 1px solid #e1e5ed;
    > div {
      line-height: 48px;
      border-bottom: 1px rgba(0, 0, 0, 0) solid;
    }
  }
  .active {
    font-weight: bold;
    height: 48px;
    @include discen;
    width: calc(100% / 2);
    border: 1px solid #e1e5ed;
    border-bottom: 0;
    background: #ffffff;
    > div {
      color: $bg_color;
      line-height: 48px;
      border-bottom: 1px $bg_color solid;
    }
  }
}
.no-data {
  text-align: center;
}
</style>